﻿using System;
using System.Windows;
using System.Windows.Data;
using System.Globalization;

namespace Omnia.Converters
{
    public class NullToResourceStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (string.IsNullOrWhiteSpace(value.ToString()))
            {
                object o = Application.Current.Resources[parameter];
                return o;
            }
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
